<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1.0, maximum-scale=1, user-scalable=no" charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="/app/css/media.css"/>
    <link rel="stylesheet" type="text/css" href="/app/css/common.css"/>

    <title>关系型数据库</title>
    <link href="/app/css/mui.picker.css" rel="stylesheet" />
    <link href="/app/css/mui.poppicker.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="/app/css/index.css"/>
    <script src="//do.yunzhijia.com/pub/js/qingjs.js"></script>
    <link href="//cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="//cdn.bootcss.com/bootstrap-slider/9.4.1/css/bootstrap-slider.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/app/css/index.css"/>
    <script src="/app/js/jquery-3.0.0.min.js"></script>
    <script src="/layer/layer.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap-slider/9.4.1/bootstrap-slider.min.js"></script>

</head>
<body style="background: #eaeff3;>
<div class="main_div">
<div class="main_body">

    <p class="topTip_p">关系型数据库价格由实例，内存组成。客户经理折扣为6折。</p>
    <div class="listing">
        <div class="items">
            <div class="item">
                <div class="iconDiv"><i>
                    <img src="/app/image/icon-1.png" width="22px"; height="22px">
                </i></div>
                <h4 class="title">计算单元主备实例</h4>
                <ul class="config_ul">
                    <li id="showDbPicker">
                        <span class="left">VCPU数量</span>
                        <div class ="rightDiv" >
                            <span class="left one" id='dBResult'>1</span><i class="_icon left" >
                            <img src="/app/image/go_right.png">
                        </i>
                        </div>

                    </li>
                    <li id='showDbMemoryPicker'>
                        <span class="left">内存容量</span>
                        <div class ="rightDiv"  class="mui-btn mui-btn-block">
                            <span class="left one" id='dBMemoryResult'>2GB</span>
                            <i class="_icon left" ><img src="/app/image/go_right.png"></i>
                        </div>
                    </li>
                </ul>
                <ul class="config2_ul" id="list_one">
                    <li>
                        <div class="_config_div left add" id="showDbPickerOne">
                            <span class="left" id="dbResultOne">SATA只读实例</span>
                            <i class="right"><img src="/app/image/go_right.png"></i>
                        </div>
                        <div class="_config_div wid35 left zhuiRou net_kd">
                            <div class="stat_minus minus1"><i><img src="/app/image/Group_MINUS.png"></i>
                            </div>
                            <input type="tel" pattern="[0-9]*" maxlength="4" id="statnumone" class="stat_num input_bg1 zhou brand_slider_num_one" value="0">
                            <div class="stat_plus plus1"><i><img src="/app/image/Group_PLUS.png"></i></div>
                        </div>
                        <#--<div class="_config_div left add right" id="showstoragePicker">
                            <span class="left" id="storageResult">只读</span>
                            <i class="right"><img src="/app/image/go_right.png"></i>
                        </div>-->
                    </li>
                </ul>
            </div>
            <div class="summary_div">
                <ul class="configInfo_ul left">
                    <li>VCPU数量*
                        <span id = "db_type_one_count">1</span>
                    </li>
                    <li>内存容量<span id="db_count_one">1</span>GB</li>
                    <li><span id = "db_band_one">SATA只读实例</span></li>
                </ul>
                <p class="price_p_zsy right " id="cpu_price_one">￥53</p>
            </div>
        </div>
        <div class="items">
            <div class="item">
                <div class="iconDiv"><i>
                    <img src="/app/image/icon-1.png" width="22px"; height="22px">
                </i></div>
                <h4 class="title">计算单元主备/只读实例</h4>
                <ul class="config_ul">
                    <li id="showDbPickertwo">
                        <span class="left">VCPU数量</span>
                        <div class ="rightDiv" >
                            <span class="left one" id='dbResultTwo'>1</span><i class="_icon left" >
                            <img src="/app/image/go_right.png">
                        </i>
                        </div>

                    </li>
                    <li id='showMemoryPickertwo'>
                        <span class="left">内存容量</span>
                        <div class ="rightDiv"  class="mui-btn mui-btn-block">
                            <span class="left one" id='dbZhiduResultTwo'>2GB</span>
                            <i class="_icon left" ><img src="/app/image/go_right.png"></i>
                        </div>
                    </li>
                </ul>
                <ul class="config2_ul" id="list_two">
                    <li>
                        <div class="_config_div left add" id="showDbPickerTwo">
                            <span class="left" id="dbZhiDuTwo">SATA只读实例</span>
                            <i class="right"><img src="/app/image/go_right.png"></i>
                        </div>
                        <div class="_config_div wid35 left zhuiRou net_kd">
                            <div class="stat_minus minus1"><i><img src="/app/image/Group_MINUS.png"></i>
                            </div>
                            <input type="tel" pattern="[0-9]*" maxlength="4" id="statnumtwo" class="stat_num input_bg1 zhou brand_slider_num_two" value="0">
                            <div class="stat_plus plus1"><i><img src="/app/image/Group_PLUS.png"></i></div>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="summary_div">
                <ul class="configInfo_ul left">
                    <li>VCPU数量*
                        <span id = "db_type_two_count">1</span>
                    </li>
                    <li>内存容量<span id="db_count_two">2</span>GB</li>
                    <li><span id = "db_band_two">SATA只读实例</span></li>
                </ul>
                <p class="price_p_zsy right " id="cpu_price_two">￥210</p>
            </div>
        </div>
    </div>
</div>
<#include "foot.ftl">

<#--//九个计算值
        //one-->
<input type="hidden" id="total_cpu_t" name="total_cpu_t" value="0">
<input type="hidden" id="total_cpu_a" name="total_cpu_a" value="0">
<input type="hidden" id="total_cpu_d" name="total_cpu_d" value="0">


<#--//存储-->
<input type="hidden" id="total_stat_t" name="total_stat_t" value="0">
<input type="hidden" id="total_stat_a" name="total_stat_a" value="0">
<input type="hidden" id="total_stat_d" name="total_stat_d" value="0">

<#--//带宽-->
<input type="hidden" id="total_brand_t" name="total_brand_t" value="0">
<input type="hidden" id="total_brand_a" name="total_brand_a" value="0">
<input type="hidden" id="total_brand_d_one" name="total_brand_d_one" value="0">
<input type="hidden" id="total_brand_d_two" name="total_brand_d_two" value="0">

<input type="hidden" id="total_ali_d_one" name="total_ali_d_one" value="0">
<input type="hidden" id="total_ali_d_two" name="total_ali_d_two" value="0">

<input type="hidden" id="total_tx_d_one" name="total_tx_d_one" value="0">
<input type="hidden" id="total_tx_d_two" name="total_tx_d_two" value="0">
<input type="hidden" id="tx_sata_tag" name="tx_sata_tag" value="0">



<input type="hidden" id="db_one_left" name="db_one_left" value="0.3">
<input type="hidden" id="db_oneail_left" name="db_oneail_left" value="0">
<input type="hidden" id="db_onetx_left" name="db_onetx_left" value="0">


<input type="hidden" id="db_two_left" name="db_two_left" value="0.3">
<input type="hidden" id="db_twoali_left" name="db_twoali_left" value="0">
<input type="hidden" id="db_twotx_left" name="db_twotx_left" value="0">

<input type="hidden" name="flag" id="flag" value="0">
<input type="hidden" name="flagNum" id="flagNum" value="0">
<input type="hidden" name="flag_die" id="flag_die" value="1">
<input type="hidden" name="flag_die_flag" id="flag_die_flag" value="1">
<input type="hidden" name="title" id="title" value="${title!}">
<input type="hidden" name="openId" id="openId" value="${openId}">
</div>
<script src="/app/js/mui.min.js"></script>
<script src="/app/js/mui.poppicker.js"></script>
<script src="/app/js/mui.picker.min.js"></script>
<script src="/app/js/yun_title.js"></script>

<script>
    (function($, doc) {
        $.init();
        $.ready(function() {
            /*第一个实例*/

            var dbMemoryPicker = new $.PopPicker();
            var dBPickerOne = new $.PopPicker();
            dBPickerOne.setData(['1','2','4','8']);
            var dBMemoryResult=doc.getElementById('dBMemoryResult');
            var db_count_one=document.getElementById('db_count_one');
            var showDbPickerButton = doc.getElementById('showDbPicker');
            var dBResult = doc.getElementById('dBResult');
            var db_type_one_count=doc.getElementById('db_type_one_count');
            /*var guiGe= doc.getElementById("guiGe");*/
            /*获取初始价格*/
            var VCPUONE=document.getElementById('dBResult');
            var MEMONE=document.getElementById('dBMemoryResult');
            var MEMONeCon=MEMONE.innerText.toString().substring(0,MEMONE.innerText.toString().length-2);
            //初始化计算价格
            getEntityPrice(VCPUONE.innerText,MEMONeCon);
            getOnePrice();
            showDbPickerButton.addEventListener('tap', function(event) {
                dBPickerOne.show(function(items) {
                    dBResult.innerText = items[0];
                    db_type_one_count.innerHTML=items[0];
                    getDbMemory(items[0]);
                    var dBMemoryResult=doc.getElementById('dbZhiduResultTwo');
                    getEntityPrice(items[0],dBMemoryResult.innerText.toString().substring(0,dBMemoryResult.innerText.toString().length-2));
                    getOnePrice();
                });
            }, false);
            /*第一个单独初始化*/
            dbMemoryPicker.setData([2,4]);
            var showDbMemoryPicker = doc.getElementById('showDbMemoryPicker');
            showDbMemoryPicker.addEventListener('tap', function(event) {
                dbMemoryPicker.show(function(items) {
                    dBMemoryResult.innerHTML=items[0]+"GB";
                    db_count_one.innerHTML=items[0];

                    getEntityPrice(dBResult.innerHTML,items[0]);
                    getOnePrice();

                });
            }, false);

            function getDbMemory(cpuDbType) {
                $.get("/getDbType/" + cpuDbType,function(data){
                    var dBMemoryArray=data.dbMemoryList;
                    var dbArray=new Array();
                    for (var i=0;i<dBMemoryArray.length;i++){
                        dbArray[i]=parseInt(dBMemoryArray[i].memory);
                    }
                    showDbMem(dbArray,dbMemoryPicker);
                });

            };
            function showDbMem(value,pickerType) {
                pickerType.setData(value);
                var showDbMemoryPicker = doc.getElementById('showDbMemoryPicker');
                var dBMemoryResult=doc.getElementById('dBMemoryResult');
                var db_count_one=document.getElementById('db_count_one');

                var dBResult=document.getElementById('dBResult');

                pickerType.pickers[0].setSelectedValue(value[0]);
                dBMemoryResult.innerHTML=value[0]+"GB";
                db_count_one.innerHTML=value[0];
                getEntityPrice(dBResult.innerHTML,value[0]);
                getOnePrice();
                showDbMemoryPicker.addEventListener('tap', function(event) {
                    dbMemoryPicker.show(function(items) {
                        dBMemoryResult.innerHTML=items[0]+"GB";
                        db_count_one.innerHTML=items[0];

                        getEntityPrice(dBResult.innerHTML,items[0]);
                        getOnePrice();
                        /*dBMemoryResult.innerHTML=value[0]+"GB";*/
                    });
                }, false);
            };

            function  getEntityPrice(cpuVal,memVal) {
                var cpuPriceone=doc.getElementById("cpu_price_one");
                var cpuPrice=document.getElementById("total_cpu_d");
                var aliPrice=document.getElementById("total_cpu_a");
                var txPrice=document.getElementById("total_cpu_t");
                $.get("/getDbPrice/"+cpuVal+"/"+memVal,function(data){
                    var prices=data.price;
                    if(prices!=null){
                        if(prices.dprice==""||prices.dprice=="0"){
                            getOnePrice();
                        }else{
                            cpuPriceone.innerHTML="￥"+(parseInt(prices.dprice));
                            cpuPrice.value=parseInt(prices.dprice);
                            getOnePrice();
                        }
                        if(prices.aprice==""||prices.aprice==null){
                            aliPrice.value=parseInt(0);
                            getOnePrice();
                        }else{
                            aliPrice.value=parseInt(prices.aprice);
                            getOnePrice();
                        }
                        if(prices.tprice==null||prices.tprice==""){
                            txPrice.value=parseInt(0);
                            getOnePrice();
                        }
                        else {
                            txPrice.value=parseInt(prices.tprice);
                            getOnePrice();
                        }
                    }

                });

            }



            /*第二个实例*/
            var dbMemoryPickertwo = new $.PopPicker();
            var dBPickerTwo = new $.PopPicker();
            dBPickerTwo.setData(['1','2','4','8']);
            var showDbPickertwoButton = doc.getElementById('showDbPickertwo');
            var dbResultTwo = doc.getElementById('dbResultTwo');
            var db_type_two_count=doc.getElementById('db_type_two_count');

            /*获取初始价格*/
            var VCPUTWO=document.getElementById('dbResultTwo');
            var MEMTWO=document.getElementById('dbZhiduResultTwo');
            var MEMTWOCon=MEMTWO.innerText.toString().substring(0,MEMTWO.innerText.toString().length-2);
            //初始化计算价格
            getEntityTwoPrice(VCPUTWO.innerText,MEMTWOCon);
            getTwoPrice();
            showDbPickertwoButton.addEventListener('tap', function(event) {
                dBPickerTwo.show(function(items) {
                    dbResultTwo.innerText = items[0];
                    db_type_two_count.innerText = items[0];
                    getDbTwoMemory(items[0]);

                    var dBMemoryResult=doc.getElementById('dBMemoryResult');
                    getEntityTwoPrice(items[0],dBMemoryResult.innerText.toString().substring(0,dBMemoryResult.innerText.toString().length-2));
                    getTwoPrice();
                });
            }, false);

            /*第二个单独初始化*/
            var dbZhiduResultTwo=document.getElementById('dbZhiduResultTwo');
            var db_count_two=document.getElementById('db_count_two');
            dbMemoryPickertwo.setData([2,4]);
            var showDbZhiDuMemoryPicker = doc.getElementById('showMemoryPickertwo');
            showDbZhiDuMemoryPicker.addEventListener('tap', function(event) {
                dbMemoryPickertwo.show(function(items) {
                    dbZhiduResultTwo.innerHTML=items[0]+"GB";
                    db_count_two.innerHTML=items[0];

                    getEntityTwoPrice(dbResultTwo.innerHTML,items[0]);
                    getTwoPrice();
                });
            }, false);







            function getDbTwoMemory(cpuDbType) {
                $.get("/getDbTwoType/" + cpuDbType,function(data){
                    var dBMemoryArray=data.dbZhiduMemoryList;
                    var dbArray=new Array();
                    for (var i=0;i<dBMemoryArray.length;i++){
                        dbArray[i]=parseInt(dBMemoryArray[i].memory);
                    }

                    showDbTwoMem(dbArray,dbMemoryPickertwo);
                });

            };
            function showDbTwoMem(value,pickerType) {
                pickerType.setData(value);
                var showDbZhiDuMemoryPicker = doc.getElementById('showMemoryPickertwo');
                var dBZhiDuMemoryResult=doc.getElementById('dbZhiduResultTwo');
                var db_count_two=document.getElementById('db_count_two');
                var dbResultTwo=document.getElementById('dbResultTwo');
                pickerType.pickers[0].setSelectedValue(value[0]);
                dBZhiDuMemoryResult.innerHTML=value[0]+"GB";
                db_count_two.innerHTML=value[0];
                getEntityTwoPrice(dbResultTwo.innerHTML,value[0]);
                getTwoPrice();
                showDbZhiDuMemoryPicker.addEventListener('tap', function(event) {
                    dbMemoryPickertwo.show(function(items) {
                        dBZhiDuMemoryResult.innerHTML=items[0]+"GB";
                        db_count_two.innerHTML=items[0];
                        getEntityTwoPrice(dbResultTwo.innerHTML,items[0]);
                        getTwoPrice();
                        /*dBMemoryResult.innerHTML=value[0]+"GB";*/
                    });
                }, false);
            };


            function  getEntityTwoPrice(cpuVal,memVal) {
                var cpuPriceone=doc.getElementById("cpu_price_two");
                var cpuPrice=document.getElementById("total_stat_d");
                var aliPrice=document.getElementById("total_stat_a");
                var txPrice=document.getElementById("total_stat_t");
                $.get("/getDbZdPrice/"+cpuVal+"/"+memVal,function(data){
                    var prices=data.price;
                    if(prices!=null){
                        if(prices.dprice==""||prices.dprice=="0"){
                            getTwoPrice();
                        }else{
                            cpuPriceone.innerHTML="￥"+(parseInt(prices.dprice));
                            cpuPrice.value=parseInt(prices.dprice);
                            getTwoPrice();
                        }
                        if(prices.aprice==""||prices.aprice==null){
                            aliPrice.value=parseInt(0);
                            getTwoPrice();
                        }else{
                            aliPrice.value=parseInt(prices.aprice);
                            getTwoPrice();
                        }
                        if(prices.tprice==null||prices.tprice==""){
                            txPrice.value=parseInt(0);
                            getTwoPrice();
                        }
                        else {
                            txPrice.value=parseInt(prices.tprice);
                            getTwoPrice();
                        }
                    }

                });

            }




            var storagePicker_one_Left = new $.PopPicker();
            storagePicker_one_Left.setData([
                {value:0.5,text:'SATA主备实例'},
                {value:0.3,text:'SATA只读实例'},
                {value:1,text:'SAS主备实例'},
                {value:0.6,text:'SAS只读实例'},
                {value:2,text:'SSD主备实例'},
                {value:1.2,text:'SSD只读实例'}]);
            var showDbPickerOne = doc.getElementById('showDbPickerOne');
            var dbResultOne = doc.getElementById('dbResultOne');
            var db_band_one=document.getElementById("db_band_one");
            showDbPickerOne.addEventListener('tap', function(event) {
                storagePicker_one_Left.show(function(items) {
                    dbResultOne.innerText = items[0].text;
                    db_band_one.innerText = items[0].text;
                    var db_one_left=doc.getElementById('db_one_left');
                    db_one_left.value=items[0].value;
                    var one_count=doc.getElementById("statnumone");
                    var one_count_num=one_count.value;
                    var total_brand_d=document.getElementById('total_brand_d_one');
                    total_brand_d.value=one_count_num*items[0].value;
                    var db_oneail_left=document.getElementById('db_oneail_left');
                    //var total_tx_d_one=document.getElementById('total_tx_d_one');
                    var db_onetx_left=document.getElementById('db_onetx_left');
                    if(items[0].value==1){
                        db_oneail_left.value=0.8;
                        db_onetx_left.value=0.72;

                    }
                    if(items[0].value==0.6){
                        db_oneail_left.value=0.72;
                        db_onetx_left.value=0.72;
                    }
                    else if(items[0].value!=0.6&&items[0].value!=1) {
                        db_oneail_left.value=0;
                        db_onetx_left.value=0;
                    }



                });
            }, false);



            var storagePicker_two_Left = new $.PopPicker();
            storagePicker_two_Left.setData([
                {value:0.5,text:'SATA主备实例'},
                {value:0.3,text:'SATA只读实例'},
                {value:1,text:'SAS主备实例'},
                {value:0.6,text:'SAS只读实例'},
                {value:2,text:'SSD主备实例'},
                {value:1.2,text:'SSD只读实例'}]);
            var showDbPickerTwo = doc.getElementById('showDbPickerTwo');
            var dbZhiDuTwo = doc.getElementById('dbZhiDuTwo');
            var db_band_two=document.getElementById("db_band_two");
            showDbPickerTwo.addEventListener('tap', function(event) {
                storagePicker_two_Left.show(function(items) {
                    dbZhiDuTwo.innerText = items[0].text;
                    db_band_two.innerHTML= items[0].text;
                    var db_two_left=doc.getElementById('db_two_left');
                    db_two_left.value=items[0].value;
                    var two_count=doc.getElementById("statnumtwo");
                    var two_count_num=two_count.value;
                    var total_brand_d=document.getElementById('total_brand_d_two');
                    total_brand_d.value=two_count_num*items[0].value;
                    var db_twoali_left=document.getElementById('db_twoali_left');
                    //var total_tx_d_one=document.getElementById('total_tx_d_one');
                    var db_twotx_left=document.getElementById('db_twotx_left');
                    if(items[0].value==1){
                        db_twoali_left.value=0.8;
                        db_twotx_left.value=0.72;

                    }
                    if(items[0].value==0.6){
                        db_twoali_left.value=0.72;
                        db_twotx_left.value=0.72;
                    }
                    else if(items[0].value!=0.6&&items[0].value!=1) {
                        db_twoali_left.value=0;
                        db_twotx_left.value=0;
                    }
                });
            }, false);













        });
    })(mui, document);
    function  count_one(num) {
        var price_one=$('#db_one_left').val();
        var db_oneail_left=$('#db_oneail_left').val();
        var db_onetx_left=$('#db_onetx_left').val();
        var total_brand_d_one=document.getElementById('total_brand_d_one');
        total_brand_d_one.value=price_one*num;
        var total_ali_d_one=document.getElementById('total_ali_d_one');
        total_ali_d_one.value=db_oneail_left*num;
        var total_tx_d_one=document.getElementById('total_tx_d_one');
        total_tx_d_one.value=db_onetx_left*num;

    };
    function  count_two(num) {
        var price_two=$('#db_two_left').val();
        var price_two_ali=$('#db_twoali_left').val();

        var price_two_tx=$('#db_twotx_left').val();
        var total_brand_d_two=document.getElementById('total_brand_d_two');
        var total_ali_d_two=document.getElementById('total_ali_d_two');
        var total_tx_d_two=document.getElementById('total_tx_d_two');

        total_brand_d_two.value=price_two*num;
        total_ali_d_two.value=price_two_ali*num;
        total_tx_d_two.value=price_two_tx*num;


    };
    $('#list_one').on("blur",'.stat_num',function (event) {
        var stat_num = parseInt($(this).val());
        if(isNaN(stat_num)){
            stat_num=0;
            $('#statnumone').text(stat_num);
            count_one(stat_num);
            getOnePrice();
        }
        if(stat_num<=0||stat_num==""){
            $(this).val(0);
            $('#statnumone').text(stat_num);
            count_one(stat_num);
            getOnePrice();
        }
        else if(stat_num>=2000){
            $(this).val(2000);
            $('#statnumone').text(stat_num);
            count_one(stat_num);
            getOnePrice();
        }
        else {
            $(this).val(stat_num);
            $('#statnumone').text(stat_num);
            count_one(stat_num);
            getOnePrice();
        }
    });
    $('#list_one').on('click','.stat_plus',function (event) {
        console.dir(this);
        var numInput = $(this).prev();
        var stat_num=parseInt(numInput.val());
        if(stat_num>=2000){
            numInput.val(2000);
            $('#statnumone').text(stat_num);
            count_one(stat_num);
            getOnePrice();

        }
        else {
            stat_num=stat_num+1;
            numInput.val(stat_num);
            numInput.value=stat_num;
            $('#statnumone').text(stat_num);
            count_one(stat_num);
            getOnePrice();
            /*count();*/
        }
    });
    $('#list_one').on('click','.stat_minus',function (event) {
        console.dir(this);
        var numInput = $(this).next();
        var stat_num=parseInt(numInput.val());
        if(stat_num<=0){
            numInput.val(0);
            $('#statnumone').text(stat_num);
            count_one(stat_num);
            getOnePrice();

        }
        else {
            stat_num=stat_num-1;
            numInput.val(stat_num);
            $('#statnumone').text(stat_num);
            count_one(stat_num);
            getOnePrice();
            /*count();*/
        }
    });

    $('#list_two').on("blur",'.stat_num',function (event) {
        var stat_num = parseInt($(this).val());
        if(isNaN(stat_num)){
            stat_num=0;
            $('#statnumtwo').text(stat_num);
            count_two(stat_num);
            getTwoPrice();
        }
        if(stat_num<=0||stat_num==""){
            $(this).val(0);
            $('#statnumtwo').text(stat_num);
            count_two(stat_num);
            getTwoPrice();
            //$('.stat_num')
            /*count();*/
        }
        else if(stat_num>=2000){
            $(this).val(2000);
            $('#statnumtwo').text(stat_num);
            count_two(stat_num);
            getTwoPrice();
            /*count();*/
        }
        else {
            $(this).val(stat_num);
            $('#statnumtwo').text(stat_num);
            count_two(stat_num);
            getTwoPrice();
            /*count();*/
        }
    });
    $('#list_two').on('click','.stat_plus',function (event) {
        console.dir(this);
        var numInput = $(this).prev();
        var stat_num=parseInt(numInput.val());
        if(stat_num>=2000){
            numInput.val(2000);
            $('#statnumtwo').text(stat_num);
            count_two(stat_num);
            getTwoPrice();
        }
        else {
            stat_num=stat_num+1;
            numInput.val(stat_num);
            $('#statnumtwo').text(stat_num);
            count_two(stat_num);
            getTwoPrice();
        }
    });
    $('#list_two').on('click','.stat_minus',function (event) {
        console.dir(this);
        var numInput = $(this).next();
        var stat_num=parseInt(numInput.val());
        if(stat_num<=0){
            numInput.val(0);
            $('#statnumtwo').text(stat_num);
            count_two(stat_num);
            getTwoPrice();
        }
        else {
            stat_num=stat_num-1;
            numInput.val(stat_num);
            $('#statnumtwo').text(stat_num);
            count_two(stat_num);
            getTwoPrice();
        }
    });
    function  getOnePrice() {
        var totalPrice=0;
        var total_cpu_d=document.getElementById('total_cpu_d');
        var price=parseFloat(total_cpu_d.value);
        var total_brand_d_one=document.getElementById('total_brand_d_one');
        var onePrice=parseFloat(total_brand_d_one.value);

        totalPrice=price+onePrice;
        $("#cpu_price_one").text(totalPrice.toFixed(2));
        getAllPrice();
    }
    function  getTwoPrice() {

        var totalPrice=0;
        var total_stat_d=document.getElementById('total_stat_d');
        var price=parseFloat(total_stat_d.value);
        var total_brand_d_two=document.getElementById('total_brand_d_two');
        var onePrice=parseFloat(total_brand_d_two.value);

        totalPrice=price+onePrice;
        $("#cpu_price_two").text(totalPrice.toFixed(2));
        getAllPrice();
    }
    function getAllPrice() {
        var cpu_price_one=document.getElementById('cpu_price_one');
        var dianxinone=parseFloat(cpu_price_one.innerHTML);
        var cpu_price_two=document.getElementById('cpu_price_two');
        var dianxintwo=parseFloat(cpu_price_two.innerHTML);

        var total_cpu_a=parseFloat($('#total_cpu_a').val());
        var total_stat_a=parseFloat($('#total_stat_a').val());
        var total_ali_d_one=parseFloat($('#total_ali_d_one').val());
        var total_ali_d_two=parseFloat($('#total_ali_d_two').val());
        if(total_cpu_a==0||total_stat_a==0||total_ali_d_one==0||total_ali_d_two==0){

            $("#ali_price").text("无此规格");
        }
        else {
            $("#ali_price").text("￥"+(total_cpu_a+total_stat_a+total_ali_d_one+total_ali_d_two).toFixed(2));
        }

        var total_cpu_t=parseFloat($('#total_cpu_t').val());
        var total_stat_t=parseFloat($('#total_stat_t').val());
        var total_tx_d_one=parseFloat($('#total_tx_d_one').val());
        var total_tx_d_two=parseFloat($('#total_tx_d_two').val());
        if(total_cpu_t==0||total_stat_t==0||total_tx_d_one==0||total_tx_d_two==0){

            $("#tx_price").text("无此规格");
        }
        else {
            $("#tx_price").text("￥"+(total_cpu_t+total_stat_t+total_tx_d_one+total_tx_d_two).toFixed(2));
        }
        $("#allprice").text("￥"+(dianxinone+dianxintwo).toFixed(2));



    }

    $('.checkInfo_right').click(function () {
        var openId=$('#openId').val();
        //VCPU
        var vCPUone=$('#db_type_one_count').text();
        var vCPUtwo=$('#db_type_two_count').text();
        var memoryResultOne=$('#db_count_one').text();
        var memoryResultTwo=$('#db_count_two').text();
        var userResult="VCPU*"+vCPUone+"  "+ memoryResultOne+"GB";

        var memoryResult="VCPU*"+vCPUtwo+"  "+ memoryResultTwo+"GB";
                /*memoryResultOne+memoryResultTwo;*/

        var tatil_stat=$('#db_band_one').text();
        var db_band_two=$('#db_band_two').text();
        var shebei= tatil_stat+db_band_two;
        /*var tatil_stat=$(".tatil_stat").text();//存储配置
        var brand_num=$('.brand').text();//带宽*/

        //三个价格
        var aliprice=$('#ali_price').text();
        var txprice=$('#tx_price').text();
        var allprice=$('#allprice').text();
        /*if(openId==null){
            alert("添加失败,请重新打开应用");
            return false;
        }*/
        if(aliprice=="无此规格"){
            aliprice=0;
        }
        else {
            aliprice=aliprice.substring(1);
        }
        if(txprice=="无此规格"){
            txprice=0;
        }
        else {
            txprice=txprice.substring(1);
        }
        allprice=allprice.substring(1);

        var data1 = {
            cpuAndMem:userResult,
            meMory:'',
            stat:memoryResult,
            brandNum:shebei,
            ali_price:aliprice,
            tx_price:txprice,
            all_price:allprice,
            productTypeId:2,
            productName:'关系型数据库',
            oneKey:'主备实例',
            twoKey:'只读实例',
            threeKey:'设备',
            oneImage:'yunzhuji-one',
            twoImage:'yunzhuji-one',
            threeImage:'yunzhuji-one'
        }
        $.post("/takeList/"+openId+"/",data1,function(data){
            if(data.type=="success"){
                layer.msg(data.msg);
            }
        });
    });




</script>




</body>

</html>